package com.example.demo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.dao.PlayerMapper;
import com.example.demo.pojo.Player;
import com.example.demo.service.PlayerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class PlayServiceImpl extends ServiceImpl<PlayerMapper, Player> implements PlayerService {

    @Autowired
    PlayerMapper playerMapper;
    @Override
    public Player getPlayerByPhone(String phone) {
        Map<String,Object> map=new HashMap<String, Object>();
        map.put("phone",phone);
        List<Player> players = playerMapper.selectByMap(map);
        if (players.isEmpty()){
            return null;
        }
        return players.get(0);
    }
}